(function(){"use strict";BX.ready(function(){if(!top.BXIM){return}var t=null;var e=[].slice.call(document.querySelectorAll("a.landing-chat-message"));if(e.length){for(var n=0,s=e.length;n<s;n++){var a=e[n];var i=a.getAttribute("href");if(i){a.addEventListener("click",function(){var e=this.substr(0,5);var n=this.substr(5);if(e==="#chat"){top.BXIM.openMessenger(n)}else if(e==="#join"){t=n;BX.ajax({url:"/bitrix/tools/landing/ajax.php",method:"POST",data:{action:"Chat::joinChat",data:{internalId:n},sessid:BX.message("bitrix_sessid")},dataType:"json",onsuccess:function(t){if(t.result){top.BXIM.openMessenger("chat"+t.result)}}})}BX.PreventDefault()}.bind(i))}}}BX.addCustomEvent("onPullEvent-im",function(e,n){if(e==="chatUserAdd"){if(t){console.log(n.users)}}})})})();
//# sourceMappingURL=chat_init.map.js